package com.shiyanlou.upms.system.service.impl;

import com.shiyanlou.upms.system.dao.UpmsUserMapper;
import com.shiyanlou.upms.system.domain.UpmsUser;
import com.shiyanlou.upms.system.service.UpmsUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 用户管理
 */
@Service("upmsUserService")
public class UpmsUserServiceImpl implements UpmsUserService {

    @Autowired
    UpmsUserMapper upmsUserMapper;

    @Override
    public UpmsUser get(Integer userId) {
        return upmsUserMapper.selectByPrimaryKey(userId);
    }

    @Override
    public int insert(UpmsUser record) {
        return upmsUserMapper.insert(record);
    }

    @Override
    public int insertSelective(UpmsUser record) {
        return upmsUserMapper.insertSelective(record);
    }

    @Override
    public int updateByPrimaryKey(UpmsUser record) {
        return upmsUserMapper.updateByPrimaryKey(record);
    }

    @Override
    public int updateByPrimaryKeySelective(UpmsUser record) {
        return upmsUserMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int deleteByPrimaryKey(Integer userId) {
        return upmsUserMapper.deleteByPrimaryKey(userId);
    }

    // 新增方法
    @Override
    public int count(Map<String, Object> map) {
        return upmsUserMapper.count(map);
    }

    @Override
    public List<UpmsUser> list(Map<String, Object> map) {
        return upmsUserMapper.list(map);
    }
    @Override
    public int batchRemove(Integer[] userIds){
        return upmsUserMapper.batchRemove(userIds);
    }
    //// 通过用户名查找用户信息
    @Override
    public UpmsUser getUserByusername(String username) {
        return upmsUserMapper.getUserByusername(username);
    }

    @Override
    public int selectUserCountByRole(Map<String, Object> map) {
        return upmsUserMapper.selectUserCountByRole(map);
    }

    @Override
    public List<UpmsUser> selectUserByRole(Map<String, Object> map) {
        return upmsUserMapper.selectUserByRole(map);
    }
}
